#include "mlistwidgetdrag.h"
#include "qmimedata.h"
#include "qdrag.h"
#include <QHash>
mListWidgetDrag::mListWidgetDrag(QWidget *parent)
    : QListWidget(parent)
{

}

mListWidgetDrag::~mListWidgetDrag()
{

}

void mListWidgetDrag::startDrag(Qt::DropActions supportedActions)
{
    QListWidgetItem *item = currentItem();
    QString pValue = item->text();
    QByteArray itemData;
    itemData = QVariant(pValue).toByteArray();

    QMimeData *mimeData = new QMimeData;
    mimeData->setData("application/x-qabstractitemmodeldatalist", itemData);

    QDrag *drag = new QDrag(this);
    drag->setMimeData(mimeData);
    drag->exec(Qt::MoveAction) ;

}


